import axios from '@/utils/request'


// 分页
export const pageApplyImport = (params) => {
  return axios({
    method: 'GET',
    url: 'import/pageApplyImport',
    params
  })
}

export const allImportType = () => {
  return axios({
    method: 'GET',
    url: 'import/allImportType',

  })
}

export const applyImport = (params) => {
  return axios({
    method: 'POST',
    url: 'import/applyImport',
    responseType: 'blob',
    params
  })
}



export const deleteImport = (id) => {
  return axios({
    method: 'POST',
    url: 'import/deleteImport/'+id,
  })
}


export const downloadFileByName = (fileName) => {
  return axios({
    method: 'GET',
    url: 'import/downloadFile/'+fileName,
  })
}


export const downloadFileById = (id) => {
  return axios({
    method: 'GET',
    url: 'import/downloadFileById/'+id,
  })
}

//下载pdf
export const downLoadForPdf = (importApplyId) => {
  return axios({
    method: 'GET',
    url: 'import/downLoadForPdf',
    //headers: { 'Content-Type': 'application/json'},
    //responseType: 'blob',
    responseType: 'stream',
    //headers: {'Content-Type':'application/pdf'},
    //RequestHeader:{"Content-Type": "application/pdf"},
    //type:'text/xml',
    //header: {"Content-Type": "multipart/form-data"},
    params:{
      importApplyId
    }
  })
}


// 下载导入模板
export function downloadTemplateByType (params) {
  return axios({
    url: 'import/downloadTemplateByType',
    method: 'GET',
    responseType: 'blob',
    params
  })
}

